﻿namespace Sidvall.Security
{
    public class EntityItem
    {
        #region Public Members

        public string EntityName { get; set; }
        public int ReadAccessLevel { get; set; }
        public int WriteAccessLevel { get; set; }

        #region ToString

        public override string ToString()
        {
            var sb = new System.Text.StringBuilder();
            sb.Append(this.EntityName);
            if (this.ReadAccessLevel >= 0)
            {
                if (this.WriteAccessLevel >= 0)
                {
                    sb.Append(" (Read-write access)");
                }
                else
                {
                    sb.Append(" (Read-only access)");
                }
            }
            else if (this.WriteAccessLevel >= 0)
            {
                sb.Append(" (Write-only access)");
            }
            else
            {
                sb.Append(" (No access)");
            }
            return sb.ToString();
        }

        #endregion

        #endregion
        #region Constructors

        public EntityItem()
        {
        }

        #endregion
    }
}
